package cn.itheima.controller;

import cn.itheima.pojo.User;
import cn.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserCotroller {

    @Autowired
    private UserService userService;

    @RequestMapping("/findAll.do")
    public List<User> findAll(){
        List<User> userList = userService.findAll();
        return userList;
    }

    @RequestMapping("/pageQuery.do")
    public Map pageQuery(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize){
        Map map = userService.pageQuery(pageNum,pageSize);
        return map;
    }


}
